# -*- coding: utf-8 -*-
# @Time    : 2020/3/12 上午10:56
# @Author  : lilong

import logging
logging.basicConfig(level=logging.INFO)


def loggingDecorator(func):
    """记录日志的装饰器"""

    def wapperLogging(*args, **kwargs):
        logging.info("开始执行 {}...".format(func.__name__))
        func(*args, **kwargs)
        logging.info("{} 执行完成！".format(func.__name__))
    return wapperLogging


def showInfo(*args, **kwargs):
    print("测试函数，参数：", args, kwargs)


@loggingDecorator
def showInfo1(a, b):
    print("测试函数，参数：", a, b)


# 测试1：showInfo被包装成了ddshowinfo，然后用新的（长相）执行相同功能
ddshowinfo = loggingDecorator(showInfo)
ddshowinfo("arg1", "arg2", kwarg1=1, kwarg2=2)

# 测试2
# showInfo1(1, 2)
